/*
 * @lc app=leetcode.cn id=141 lang=golang
 *
 * [141] 环形链表
 */

// @lc code=start
/**
 * Definition for singly-linked list.
 * type ListNode struct {
 *     Val int
 *     Next *ListNode
 * }
 */
func hasCycle(head *ListNode) bool {
	if head == nil {
		return false
	}
	i, j := head, head
	for j != nil && j.Next != nil {
		i = i.Next
		j = j.Next.Next
		if i == j {
			return true
		}
	}
	return false
}

// @lc code=end

